﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace EnterpriseWebsiteApi.ActionResults
{
    public class Error : JsonResult
    {
#if DEBUG
        public Error(Exception ex, object data = null)
            : base(new { Code = 500, exception = ex.ToString(), Data = data })
        {
        }
#else
        public Error(Exception ex, object data = null)
            : base(new { Code = 500, exception = ex.Message, Data = data })
        {
        }
#endif

        public Error(string ex, object data = null)
            : base(new { Code = 500, exception = ex, Data = data })
        {

        }
    }
}
